# include <reg52.h>
# define LCDDATA P2
sbit RS=P3^0;
sbit RW=P3^1;
sbit EN=P3^2;

void LcdDelay(unsigned char x)
{
    while(x--);
}

void LcdWriteCommand(unsigned char com)
{
    RS=0;
    RW=0;
    LCDDATA=com;
    LcdDelay(5);
    EN=1;
    EN=0;
}
void LcdWriteData(unsigned char dat)
{
    RS=1;
    RW=0;
    LCDDATA=dat;
    LcdDelay(5);
    EN=1;
    EN=0;
}
void LcdInit()
{
    LcdWriteCommand(0x38);
    LcdWriteCommand(0x0C);
    LcdWriteCommand(0X06);
    LcdWriteCommand(0x01);
}